import numpy as np
# 创建向量
arr = np.arange(10, 100, 10)
print(arr) # [10 20 30 40 50 60 70 80 90]
# 分裂数组
arr1,arr2,arr3 = np.split(arr,[2,8])
print(arr1) # [10 20]
print(arr2) # [30 40 50 60 70 80]
print(arr3) # [90]


# 矩阵的分裂
# 创建矩阵
arr = np.arange(1,9).reshape(2,4)
print(arr)
"""
[[1 2 3 4]
 [5 6 7 8]]
"""
# 按第一个维度（行）分裂
arr1,arr2 = np.split(arr,[1])
print(arr1) # [[1 2 3 4]]
print()
print(arr2) # [[5 6 7 8]]

# 按第二个维度（列）分裂
arr1,arr2,arr3 = np.split(arr,[1,2],axis=1)
print(arr1)
"""
[[1]
 [5]]
"""
print(arr2)
"""
[[2]
 [6]]
"""
print(arr3)
"""
[[3 4]
 [7 8]]
"""